package com.chinasofti.demo02;

import com.mysql.jdbc.JDBC4Connection;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Properties;

public class MyConnection1 extends JDBC4Connection {

    private Connection con;
    private List<Connection> pool;

    public MyConnection1(String hostToConnectTo, int portToConnectTo,
                         Properties info, String databaseToConnectTo, String url,
                         Connection con,List<Connection> pool) throws SQLException {
        super(hostToConnectTo, portToConnectTo, info, databaseToConnectTo, url);
        this.con = con;
        this.pool = pool;
    }
    //重写close方法
    @Override
    public void close()throws SQLException{
        pool.add(con);
    }

}